<h1><?php echo $title ?></h1>

<?php if ($errors = validation_errors()) { ?>
	<div class="alert alert-block alert-error fade in">
		<button class="close" type="button" data-dismiss="alert"> x </button>
		<?php echo $errors ?>
	</div>
<?php } ?>

<?php echo form_open() ?>
<table>
	<tr>
		<td width="150">Parent:</td>
		<td>
			<?php if (get_instance()->uri->segment(3) == 'add') { ?>
				<?php echo form_dropdown('parent_id', $parents, set_value('parent_id', $territory[0]->territory_id), 'disabled="disabled"') ?>
				<?php echo form_hidden('parent', set_value('parent', $territory[0]->territory_id)) ?>
			<?php } else { ?>
				<?php echo form_dropdown('parent_id', $parents, set_value('parent_id', $territory[0]->parent_id), 'disabled="disabled"') ?>
				<?php echo form_hidden('parent', set_value('parent', $territory[0]->parent_id)) ?>
			<?php } ?>
		</td>
	</tr>
	<tr>
		<td>Nama:</td>
		<td><?php echo form_input('name', set_value('name', $territory[0]->territory_name), 'autocomplete="off"') ?></td>
	</tr>
	<tr>
		<td>Dikelola Oleh:</td>
		<td><?php echo form_dropdown('user', $users, set_value('user', $territory[0]->user_id)) ?></td>
	</tr>
	<tr>
		<td>Tipe Teritori:</td>
		<td>
			<strong><?php echo $type ?></strong>
			<?php echo form_hidden('territory_type', set_value('territory_type', $idtype)) ?>
		</td>
	</tr>
	<tr>
		<td>Kode Teritori:</td>
		<td><?php echo @form_input('territory_code', set_value('territory_code', $territory_code), 'autocomplete="off"') ?></td>
	</tr>
	<tr>
		<td>Kode Teritori 2:</td>
		<td><?php echo @form_input('territory_code2', set_value('territory_code2', $territory_code2), 'autocomplete="off"') ?></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><?php echo form_submit('submit', 'Submit', 'class="btn btn-primary"') ?></td>
	</tr>
</table>
<?php echo form_close() ?>